Macromedia Flex Article

Delivering Rich Business Intelligence


Table of Contents

  1. Introduction
  2. The Old-School Way of Doing Business
  3. From Poor to Rich
  4. The Benefits of Using Flex
  5. Building a Rich Client Interface
  6. Conclusion

Building a Rich Client Interface

Without getting into too much detail, we want to show how you can use basic MXML and Flex components to create a custom interface for an RIA. In this case, we are using our own EIS as an example.

To make the example easier for you to follow, look at Figure 2, which shows the finished application screen and the underlying wire frame design document (Figure 2).

Figure 2. The completed EIS screen (left) and the wire frame on which it is based (right).

The similarities between the completed application screen and the wire frame are obvious. For the sake of brevity, we are going to focus on only a few of the interface elements:

  • TabBar (using a ViewStack element): This component enables the user to switch between the scorecard view and the reports view in the application interface. The TabBar is in the top right corner of the EIS screen and the wire frame in Figure 2.

    <mx:TabBar widthFlex="1" dataProvider="tnav" styleName="tabstyle" 
    	tabHeight="30" borderStyle="none" visible="true" horizontalAlign="right" 
    	id="tbar" tabWidth="160" marginRight="19" />
    <mx:ViewStack id="tnav">
    	<scorecard label="Scorecard" backgroundColor="#621619"/>
    	<report label="Reports" backgroundColor="#621619"/>
    </mx:ViewStack>
  • The scorecard: The scorecard is defined as the entire area below the TabBar component. It is the container for the three elements listed below: filterBar, glanceBar, and glanceChart.

    <mx:VBox verticalGap="15" horizontalAlign="center">
    <filterBar id="fBar"/>
    <mx:VBox verticalGap="15" hScrollPolicy="off" backgroundSize="100%" 
    	backgroundImage="@Embed('assets/contentArea.swf')" vScrollPolicy="off" 
    	id="contentArea" marginBottom="15" marginTop="15" width="975" 
    	height="555">
    	
    <glanceBar id="compGlanceBar" marginLeft="25" marginRight="25"/>
    <mx:HBox marginLeft="25" marginRight="25" horizontalGap="25">
    <trendPane id="compTrendPane"/>
    <pipelinePane id="compPipelinePane"/>
    </mx:HBox>
    </mx:VBox>
    </mx:VBox>
  • filterBar: The filterBar element is the black horizontal strip that appears below the tab-based navigation. This element is used to filter the data on the screen based on a variety of criteria.

    <mx:Canvas show="filterBarShow()" xmlns:mx="http://www.macromedia.com/2003/mxml">
    
    <mx:Script source="as/filterBar.as"/>
    <mx:Effect>
    
    <mx:Fade name="fade1" alphaFrom="0" alphaTo="100" duration="900"/>
    <mx:Sequence name="fade2">
    <mx:Pause duration="900"/>
    <mx:Fade alphaFrom="0" alphaTo="100" duration="900"/>
    </mx:Sequence>
    </mx:Effect>
    
    <mx:Image id="bar" source="assets/filterBar.swf" showEffect="fade1"/>
    
    <mx:Image id="barhighlight" source="assets/filterBar_highlight.swf" 
    	showEffect="fade2" draw="barhighlightInit()" endEffect="controlEndEffect()"/>
        <buFilter id="control" showEffect="fade1" marginLeft="25" marginTop="20"/>
    </mx:Canvas>
  • glanceBar: The area in the middle of the screen which contains the series of charts is called the glanceBar element. The glanceBar and the glanceChart (introduced in the following bullet item) elements are so named because of our design approach to contain a high volume of data that is viewable by the reader at a glance. The glanceBar element is a container for each of the individual glanceChart components that you will see below.

    <mx:HBox showEffect="slideDown1" hScrollPolicy="off" widthFlex="1" 
    	vScrollPolicy="off" horizontalAlign="center" id="chartView" marginLeft="10" 
    	verticalAlign="middle" marginRight="10" hideEffect="slideUp1"> 
     
    <glanceMetric id="gm1" metricName="Revenue" queryName="REV" 
    	initialize="initChart(gm1)" mouseDown="getTrendData('REV')" /> 
    <mx:Spacer widthFlex="1"/> 
    
    <glanceMetric id="gm2" metricName="Utilization" queryName="UTIL" 
    	initialize="initChart(gm2)" mouseDown="getTrendData('UTIL')" />  
     
    <mx:Spacer widthFlex="1"/> 
     
    <glanceMetric id="gm3" metricName="Rate" queryName="RATE" 
    	initialize="initChart(gm3)" mouseDown="getTrendData('RATE')" />  
     
    <mx:Spacer widthFlex="1"/> 
     
    <glanceMetric id="gm4" metricName="Gross Margin" queryName="GROSSMARGIN" 
    	initialize="initChart(gm4)" mouseDown="getTrendData('GROSSMARGIN')" /> 
    </mx:HBox>
  • glanceChart: The glanceChart custom component is our favorite part of the EIS application’s unique interface. While we can’t show you the code that makes up the glanceChart component itself, we can show you how unbelievably simple it is to include this or any custom component into your own Flex application. You will notice that we set the dataProvider property for this custom component as easily as with any of the other data-aware controls available in Flex.

    <glanceChart id="chart" title="{metricName}" threshold="0.5" 
    	dp="{trendWS.getEIS_Metrics.result}" 
    	mouseDown="_root.getTrendData(trendWS.getEIS_Metrics.request.QueryName)"/>